home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-3-1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  3.5 KB  |  115 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPlanes 
  3.    BackColor       =   &H80000009&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Form1"
  6.    ClientHeight    =   7200
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   11085
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   7200
  14.    ScaleWidth      =   11085
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   3  'Windows Default
  17.    WindowState     =   2  'Maximized
  18.    Begin VB.CommandButton cmdQuit 
  19.       Caption         =   "&Quit"
  20.       Height          =   375
  21.       Left            =   10080
  22.       TabIndex        =   3
  23.       Top             =   6840
  24.       Width           =   975
  25.    End
  26.    Begin VB.ComboBox cboDirection 
  27.       Height          =   315
  28.       ItemData        =   "13-3-1.frx":0000
  29.       Left            =   10080
  30.       List            =   "13-3-1.frx":000D
  31.       TabIndex        =   2
  32.       Text            =   "Right"
  33.       Top             =   5640
  34.       Width           =   975
  35.    End
  36.    Begin VB.CommandButton cmdDropBomb 
  37.       Caption         =   "&Drop Bomb"
  38.       Height          =   375
  39.       Left            =   10080
  40.       TabIndex        =   1
  41.       Top             =   6360
  42.       Width           =   975
  43.    End
  44.    Begin VB.CommandButton cmdMove 
  45.       Caption         =   "&Move"
  46.       Height          =   375
  47.       Left            =   10080
  48.       TabIndex        =   0
  49.       Top             =   5160
  50.       Width           =   975
  51.    End
  52.    Begin VB.Image imgPlanePic 
  53.       Height          =   1335
  54.       Left            =   5520
  55.       Picture         =   "13-3-1.frx":0022
  56.       Stretch         =   -1  'True
  57.       Top             =   3480
  58.       Width           =   1815
  59.    End
  60.    Begin VB.Image imgBombPic 
  61.       Height          =   480
  62.       Left            =   600
  63.       Picture         =   "13-3-1.frx":10060
  64.       Stretch         =   -1  'True
  65.       Top             =   2280
  66.       Visible         =   0   'False
  67.       Width           =   1080
  68.    End
  69.    Begin VB.Image imgBomberPic 
  70.       Height          =   1800
  71.       Left            =   120
  72.       Picture         =   "13-3-1.frx":10D22
  73.       Stretch         =   -1  'True
  74.       Top             =   120
  75.       Width           =   2520
  76.    End
  77. Attribute VB_Name = "frmPlanes"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Private bomber As CPlane
  83. Private plane As CPlane
  84. Private WithEvents bomb As CBomb
  85. Attribute bomb.VB_VarHelpID = -1
  86. Private Sub Form_Load()
  87.   Set bomber = New CPlane
  88.   Set plane = New CPlane
  89.   Set bomb = New CBomb
  90.   bomber.imagePlane = imgBomberPic
  91.   plane.imagePlane = imgPlanePic
  92.   bomb.imageBomb = imgBombPic
  93. End Sub
  94. Private Sub bomb_BombPositionChanged(X As Integer, Y As Integer, H As Integer, W As Integer)
  95.   'Check to see if Plane is hit, i.e. the bomb is inside plane or vice versa.
  96.   If plane.Present() Then
  97.       If (plane.X <= X) And (plane.X + plane.W >= X) And _
  98.          (plane.Y <= Y) And (plane.Y + plane.H >= Y) Or _
  99.          (X <= plane.X) And (X + W >= plane.X) And _
  100.          (Y <= plane.Y) And (Y + H >= plane.Y) Then
  101.          plane.Destroy
  102.          bomb.Destroy
  103.       End If
  104.    End If
  105. End Sub
  106. Private Sub cmdMove_Click()
  107.   bomber.Fly cboDirection.Text, frmPlanes.Height, frmPlanes.Width
  108. End Sub
  109. Private Sub cmdDropBomb_Click()
  110.   bomb.GoDown bomber, frmPlanes.Height
  111. End Sub
  112. Private Sub cmdQuit_Click()
  113.   End
  114. End Sub
  115.